//
//  DCHBackView.m
//  DCH-BaiSiBuDeJie
//
//  Created by apple on 16/10/22.
//  Copyright © 2016年 xiaomage. All rights reserved.
//

#import "DCHBackView.h"

@implementation DCHBackView

+ (instancetype)backViewWithImage:(UIImage *)image highImage:(UIImage *)highImage target:(id)target action:(SEL)action title:(NSString *)title
{
    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    [backButton setTitle:title forState:UIControlStateNormal];
    [backButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [backButton setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
    [backButton setImage:image forState:UIControlStateNormal];
    [backButton setImage:highImage forState:UIControlStateHighlighted];
    
    [backButton sizeToFit];
    [backButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    DCHBackView *view = [[self alloc] initWithFrame:backButton.bounds];
    [view addSubview:backButton];
    
    return view;
}


@end
